package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.NursingProjectDto;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @ Description NursingProjectMapper
 * @ Author zhengsuhang
 * @ Date 2025-05-08  11:07
 */
@Mapper
public interface NursingProjectMapper {


    /**
     * 护理项目分页查询(带条件)
     * @param nursingProjectDto
     * @return
     */
    Page<NursingProject> pageNursingProjectQuery(NursingProjectDto nursingProjectDto);

    /**
     * 新增护理项目
     * @param nursingProject
     * 新增的SQL语句: insert into 表名(字段1, 字段2,...) values (值1, 值2,...)
     */
    void addNursingProject(NursingProject nursingProject);

    /**
     * 根据id查询护理项目
     * @param id
     * @return
     */
    @Select("select * from nursing_project where id = #{id}")
    NursingProject getById(Integer id);

    /**
     * 根据id查询护理项目
     * @param nursingProject
     * 经过分析需要动态的SQL语句
     * 更新的SQL语句:update 表名 set 字段1 = 值1, 字段2 = 值2... where 条件
     */
    void updateNursingProject(NursingProject nursingProject);

    /**
     * 启用禁用
     * @param id
     * @param status
     * 更新的SQL语句: update 表名 set 字段1 = 值1, 字段2 = 值2... where 条件
     */
    @Update("update nursing_project set status = #{status} where id = #{id}")
    void setSwitchStatus(Long id, Integer status);

    @Select("select * from nursing_project")
    List<NursingProjectVo> findAll();
}
